<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <div id="app">
      <h3>作用域插槽</h3>
      <!-- <child>{{count}}</child> -->
      <!-- 子组件的slot标签上面使用自定义属性 -->
      <!-- 在父组件使用v-slot -->
      <child>
        <template v-slot:default="{count}"> {{ count }} </template>
      </child>
    </div>

    <script src="../Vue.js"></script>
    <script>
      const Child = {
        data() {
          return {
            count: 20,
          };
        },
        template: `
          <div>
            child - <slot :count="count"></slot>
          </div>
        `,
      };
      new Vue({
        el: "#app",
        // data: {
        //   count: 10,
        // },
        components: {
          Child,
        },
      });
    </script>
  </body>
</html>
